//Hash?But I don't want any HACK data...
#include<bits/stdc++.h>
using namespace std;
#define lup(var,start,end) for(long long var=start;var<=end;var++)
#define ldn(var,start,end) for(long long var=start;var>=end;var--)
#define MAX_N 100005
typedef long long ll;
ll read(void);
void write(ll);
long long n,flag,s,m1[MAX_N],m2[MAX_N],h,cnt;//m1 able m2 remain
set<ll> r;
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    n=read();
    lup(i,1,n)
    {
        ll t=read();
        s=r.size();
        r.insert(t);
        m1[t]++;
        m2[t]++;
    }
    set<ll>::iterator it=r.begin();
    h=*it;
    it++;
    while(it!=r.end())
    {
        if(m1[*it]>=m2[h])
        {
            m1[*it]-=m2[h];
            m2[h]=m1[h]=0;
        }
        else
        {
            m2[*it]+=m2[h]-m1[*it];
            m1[*it]=m1[h];
        }
        //printf("%d %d %d %d %d %d\n",h,m1[h],m2[h],*it,m1[*it],m2[*it]);
        h=*it;
        it++;
    }
    if(m1[*it]>=m2[h])
    {
        m1[*it]-=m2[h];
        m2[h]=m1[h]=0;
    }
    else
    {
        m2[*it]+=m2[h]-m1[*it];
        m1[*it]=m1[h];
    }
    //printf("%d %d %d %d %d %d\n",h,m1[h],m2[h],*it,m1[*it],m2[*it]);
    write(m2[*it]);
    return 0;
}
inline ll read(void)
{
    char ch=getchar();
    int input_sign=1;
    long long input_result=0;
    while(ch<'0'||ch>'9')
    {
        if(ch=='-')input_sign=-1;
        ch=getchar();
    }
    while(ch<='9'&&ch>='0')
    {
        input_result=(input_result<<1)+(input_result<<3);
        input_result+=ch^48;
        ch=getchar();
    }
    return input_sign*input_result;
}
inline void write(ll output_value)
{
    if(output_value<0)
    {
        output_value=0-output_value;
        putchar('-');
    }
    if(output_value==0)
    {
        putchar('0');
        return;
    }
    int output_digit[40],output_len=0;
    while(output_value>0)
    {
        output_digit[++output_len]=(output_value%10)^48;
        output_value/=10;
    }
    for(int i=output_len; i>=1; i--)putchar(output_digit[i]);
}
